package com.study.zgw.java;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Integer> numberList = new ArrayList<>();
        numberList.add(1);
        numberList.add(2);
        numberList.add(3);

        // 定义一个Function，将整数乘以2
        Function<Integer, Integer> multiplyByTwo = (x) -> x * 2;
        List<Integer> resultList = new ArrayList<>();
        for (Integer number : numberList) {
            resultList.add(multiplyByTwo.apply(number));
        }
        System.out.println(resultList);

        
    }
}
